package com.woniu.adapter;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.woniu.outlet.dao.*;
import com.woniu.outlet.po.*;
import com.woniu.util.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Component
@Transactional
public class CompanyBusinessAdapter {

    @Autowired
    private CompanyCurrentAccountMapper companyCurrentAccountMapper;

    @Autowired
    private CompanyCurrentTransferMapper companyCurrentTransferMapper;

    @Autowired
    private CompanyRegularAccountMapper companyRegularAccountMapper;

    @Autowired
    private CompanyRegularTransferMapper companyRegularTransferMapper;

    @Autowired
    private CompanyCardMapper companyCardMapper;

    @Autowired
    private CompanyCartTransferMapper companyCartTransferMapper;

    @Autowired
    private CompanyLoanMapper companyLoanMapper;

    @Autowired
    private CompanyLoanTransferMapper companyLoanTransferMapper;

    //查看企业的活期账户信息，可以多条件查询(查询的都是本客户经理下面的客户信息),所有的信息全部从redis里面来取
    public List<CompanyCurrentAccount> findCompanyCurrentAccount(Integer wokerid, Integer companyid){
        List<CompanyCurrentAccount> companyCurrentAccountlist = companyCurrentAccountMapper.findCompanyCurrentAccount(wokerid,companyid);
        //System.out.println(companyCurrentAccountlist.toString());
        return companyCurrentAccountlist;
    }

    //可以根据客户的信息（比如客户的账户号）来查询客户的活期存款的记录
    public List<CompanyCurrentTransfer> findCompanyCurrentTransfer(String companycurrentAccount){
        List<CompanyCurrentTransfer> companyCurrentTransfer = companyCurrentTransferMapper.findCompanyCurrentTransfer(companycurrentAccount);
        return companyCurrentTransfer;
    }

    //查看企业的定期账户信息，可以多条件查询(查询的都是本客户经理下面的客户信息)
    public List<CompanyRegularAccount> findCompanyRegularAccount(Integer wokerid, Integer companyid){
        List<CompanyRegularAccount> companyRegularAccount = companyRegularAccountMapper.findCompanyRegularAccount(wokerid, companyid);
        return companyRegularAccount;
    }

    //可以根据客户的信息（比如客户的账户号）来查询客户的定期存款的记录
    public List<CompanyRegularTransfer> findCompanyRegularTransfer(String companyregularAccount){
        List<CompanyRegularTransfer> companyRegularTransfer = companyRegularTransferMapper.findCompanyRegularTransfer(companyregularAccount);
        return companyRegularTransfer;
    }

    //查看企业的银行卡信息，可以多条件查询(查询的都是本客户经理下面的客户信息)
    public List<CompanyCard> findCompanyCard(Integer wokerid, Integer companyid){
        List<CompanyCard> companyCard = companyCardMapper.findCompanyCard(wokerid, companyid);
        return companyCard;
    }

    //可以根据客户的信息（比如客户的账户号）来查询客户的银行卡存款的记录
    public List<CompanyCartTransfer> findCompanyCartTransfer(String companycardNum){
        List<CompanyCartTransfer> companyCartTransfer = companyCartTransferMapper.findCompanyCartTransfer(companycardNum);
        return companyCartTransfer;
    }

    //查看企业的贷款信息，可以多条件查询(查询的都是本客户经理下面的客户信息)
    public List<CompanyLoan> findCompanyLoan(Integer wokerid,Integer companyid){
        List<CompanyLoan> companyLoan = companyLoanMapper.findCompanyLoan(wokerid, companyid);
        return companyLoan;
    }

    //可以根据客户的信息（比如客户的账户号）来查询客户的贷款的记录
    public List<CompanyLoanTransfer> findCompanyLoanTransfer(String companyloanAccount){
        List<CompanyLoanTransfer> companyLoanTransfer = companyLoanTransferMapper.findCompanyLoanTransfer(companyloanAccount);
        return companyLoanTransfer;
    }



}
